#set( $symbol_pound = '#' )
#set( $symbol_dollar = '$' )
#set( $symbol_escape = '\' )
package ${package}.infrastructure.adapter.xxx;

import ${package}.domain.xxx.adapter.IMqServiceAdapter;
import ${package}.infrastructure.mq.IRocketmqService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 使用IMqServiceAdapter实现
 * 这里只是举一个例子，并不总是直接掉mq的方法，实际可能还要做其他的处理再调用mq的方法
 */
@Service("mqServiceAdapter")
@Slf4j
public class MqServiceAdapter implements IMqServiceAdapter {
    @Resource
    private IRocketmqService rocketmqService;

    @Override
    public void asyncSendMessage(String topic, String message) {
        rocketmqService.asyncSendMessage(topic, message);
    }

    @Override
    public void sendMessage(String topic, String message) {
        rocketmqService.sendMessage(topic, message);
    }

    @Override
    public void syncSendMessage(String topic, String message) {
        rocketmqService.syncSendMessage(topic, message);
    }

    @Override
    public void sendOneWayMessage(String topic, String message) {
        rocketmqService.sendOneWayMessage(topic, message);
    }

    @Override
    public void syncSendOrderlyMessage(String topic, String message, String shardingKey) {
        rocketmqService.syncSendOrderlyMessage(topic, message, shardingKey);
    }

    @Override
    public void sendDelayedMessage(String topic, String message, Integer timeout, Integer delayLevel) {
        rocketmqService.sendDelayedMessage(topic, message, timeout, delayLevel);
    }
}
